updating oE writefln

writefln

include io.e 
namespace io 
public procedure writefln(object fm, object data = {}, object fn = 1, 
        object data_not_string = 0) 

writes formatted text to a file, ensuring that a new line is also output.

Parameters:
  1. fm : sequence, Format pattern.
  2. data : sequence, The data that will be formatted,
  3. fn : object, The file to receive the formatted output. Default is to the STDOUT device (console).
  4. data_not_string: object, If not 0 then the data is not a string. By default this is 0 meaning that data could be a single string.
Comments:
  • This is the same as writef, except that it always adds a New Line to the output.
  • When fn is a file name string, it is opened for output, written to and then closed.
  • When fn is a two-element sequence containing a file name string and an output type ("a" for append, "w" for write), it is opened accordingly, written to and then closed.
  • When fn is a file handle, it is written to only
  • The fm uses the formatting codes defined in text:format.
Example 1:
-- To console 
writefln("Today is [4], [u2:3] [3:02], [1:4].",  
         {Year, MonthName, Day, DayName}) 
-- To "sample.txt" 
writefln("Today is [4], [u2:3] [3:02], [1:4].",  
         {Year, MonthName, Day, DayName}, "sample.txt") 
-- Appended to "sample.log" 
writefln("Today is [4], [u2:3] [3:02], [1:4].",  
         {Year, MonthName, Day, DayName}, {"sample.log", "a"}) 
See Also:

text:format, writef, write_lines

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu